import { _decorator } from "cc";
import { ecs } from "db://oops-framework/libs/ecs/ECS";
import { CCVMParentComp } from "db://oops-framework/module/common/CCVMParentComp";
import { Buff } from "../Buff";

const { ccclass, property } = _decorator;

/** 视图层对象 - 支持 MVVM 框架的数据绑定 */
@ccclass('BuffIconViewComp')
@ecs.register('BuffIconView', false)
export class BuffIconViewComp extends CCVMParentComp {
    /** 脚本控制的界面 MVVM 框架绑定数据 */
    data: any = {
        iconPath: ""
    };
    
    onLoad(): void {
        this.data.iconPath = (this.ent as Buff).BuffModel.table.icon_path;
        super.onLoad();
    }

    reset() {
        this.node?.destroy();
    }
}